home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 November / PCWorld_2006-11_cd.bin / domacnost a kancelar / findgraph / fgraph.exe / {app} / TestVC / MainView.h < prev    next >
C/C++ Source or Header  |  2002-11-20  |  6KB  |  182 lines

  1. // MainView.h : interface of the CMainView class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4.  
  5. #if !defined(AFX_MAINVIEW_H__51F9B1ED_CAEF_11D4_A5D3_444553540000__INCLUDED_)
  6. #define AFX_MAINVIEW_H__51F9B1ED_CAEF_11D4_A5D3_444553540000__INCLUDED_
  7.  
  8. #if _MSC_VER > 1000
  9. #pragma once
  10. #endif // _MSC_VER > 1000
  11.  
  12. class CRectItem;
  13.  
  14. class CDot
  15. {
  16. public:
  17.     CDot()
  18.     {
  19.         m_fX = m_fY = m_fZ = 0.;
  20.     }
  21.     double    m_fX,
  22.             m_fY,
  23.             m_fZ;
  24. };
  25.  
  26.  
  27. class CMainView : public CScrollView
  28. {
  29. protected: // create from serialization only
  30.     CMainView();
  31.     DECLARE_DYNCREATE(CMainView)
  32.     DWORD m_dwIdDots;
  33. // Attributes
  34. public:
  35.     CMainDoc* GetDocument()
  36.     {
  37.         ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMainDoc)));
  38.         return (CMainDoc*) m_pDocument;
  39.     }
  40.  
  41.     CRectItem* GetSelection() const
  42.         { return m_pSelection; } // Just the top-most window
  43.     // set bSafeSelect to TRUE when there is a chance that an inplace
  44.     // active item could be deactivated before finishing
  45.     void SetSelection(CRectItem* pNewSel, BOOL bSafeSelect = FALSE);
  46.  
  47.     LPDISPATCH GetIDispatch();
  48.  
  49.  
  50. // Operations
  51. public:
  52.     void ClientToDoc(CRect &rc);
  53.     void DocToClient(CRect &rc);
  54.     void ClientToDoc(CPoint &pt);
  55.     void DocToClient(CPoint &pt);
  56.     void ClientToDoc(CSize &sz);
  57.     void DocToClient(CSize &sz);
  58.     void UpdateActiveItem();
  59.     void ClearAll();
  60.     void UnSelect() { m_pSelection = NULL; }
  61.  
  62.     void FindGraphsSet(); 
  63.     void FindGraphsGet(); 
  64.     void FindGraphsParams(); 
  65.  
  66. // Overrides
  67.     // ClassWizard generated virtual function overrides
  68.     //{{AFX_VIRTUAL(CMainView)
  69.     public:
  70.     virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
  71.     virtual void OnDraw(CDC* pDC);  // overridden to draw this view
  72.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  73.     protected:
  74.     virtual void OnInitialUpdate(); // called first time after construct
  75.     virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
  76.     virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
  77.     virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
  78.     virtual BOOL IsSelected(const CObject* pDocItem) const;// Container support
  79.     virtual BOOL OnScrollBy(CSize sizeScroll, BOOL bDoScroll = TRUE);
  80.     virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
  81.     //}}AFX_VIRTUAL
  82.  
  83. // Implementation
  84. protected:
  85.     // m_pSelection holds the selection to the current CRectItem.
  86.     // For many applications, such a member variable isn't adequate to
  87.     //  represent a selection, such as a multiple selection or a selection
  88.     //  of objects that are not CRectItem objects.  This selection
  89.     //  mechanism is provided just to help you get started.
  90.  
  91.     BOOL m_bIsNet;
  92.     CRectItem* m_pSelection;
  93.     static CBrush NEAR m_brHatch;
  94.     static CLIPFORMAT m_cfObjectDescriptor;
  95.     BOOL m_bInDrag;
  96.     COleDropTarget m_dropTarget;
  97.     CPoint m_dragPoint;
  98.     CSize  m_dragSize;
  99.     CSize  m_dragOffset;
  100.     DROPEFFECT m_prevDropEffect;
  101.  
  102.     CPoint m_pointMouse; // mouse click for paste
  103.  
  104.     
  105.     CRectItem* GetHitItem(CPoint point);
  106.     BOOL GetObjectInfo(COleDataObject* pDataObject, // for drag drop
  107.                         CSize* pSize, CSize* pOffset);
  108.     void       DoPasteNative(COleDataObject* pDataObject, CPoint* pPoint,
  109.                              CRectItem* pItem);
  110.     void       DoPasteStandard(BOOL bLink, COleDataObject* pDataObject,
  111.                              CPoint* pPoint, CRectItem* pItem, CLIPFORMAT cfFormat = 0);
  112.     CRectItem* DoPasteItem    (BOOL bLink, COleDataObject* pDataObject,
  113.                              CPoint* pPoint, CLIPFORMAT cfFormat = 0);
  114.  
  115.     void       SelectionSetSize(CSize &size);
  116.  
  117. public:
  118.     virtual ~CMainView();
  119. #ifdef _DEBUG
  120.     virtual void AssertValid() const;
  121.     virtual void Dump(CDumpContext& dc) const;
  122. #endif
  123.  
  124.     // drag drop implementation
  125.     virtual BOOL OnDrop(COleDataObject* pDataObject,
  126.         DROPEFFECT dropEffect, CPoint point);
  127.     virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject,
  128.         DWORD grfKeyState, CPoint point);
  129.     virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject,
  130.         DWORD grfKeyState, CPoint point);
  131.     virtual void OnDragLeave();
  132.  
  133. protected:
  134.     // OLE Client support
  135.     void SetupTracker(CRectTracker* pTracker, CRectItem* pItem, CRect* pTrueRect = NULL);
  136.     void InvalidateItem(CRectItem* pItem);
  137.     BOOL InsertObject(CLSID clsid, int x=0, int y=0); 
  138.  
  139. // Generated message map functions
  140. protected:
  141.     //{{AFX_MSG(CMainView)
  142.     afx_msg void OnDestroy();
  143.     afx_msg void OnSetFocus(CWnd* pOldWnd);
  144.     afx_msg void OnSize(UINT nType, int cx, int cy);
  145.     afx_msg void OnInsertObject();
  146.     afx_msg void OnCancelEditCntr();
  147.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  148.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  149.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  150.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  151.     afx_msg void OnEditClear();
  152.     afx_msg void OnEditCopy();
  153.     afx_msg void OnEditCut();
  154.     afx_msg void OnPaste();
  155.     afx_msg void OnObjectResetsize();
  156.     afx_msg void OnUpdateEditMenu(CCmdUI* pCmdUI);
  157.     afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
  158.     afx_msg void OnUpdateEditClearAll(CCmdUI* pCmdUI);
  159.     afx_msg void OnEditClearAll();
  160.     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  161.     afx_msg void OnEditPasteInview();
  162.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  163.     afx_msg void OnViewNet();
  164.     afx_msg void OnUpdateViewNet(CCmdUI* pCmdUI);
  165.     afx_msg void OnInsertFindGraph();
  166.     afx_msg void OnItemDots();
  167.     afx_msg void OnUpdateItemDots(CCmdUI* pCmdUI);
  168.     afx_msg void OnItemDotsget();
  169.     afx_msg void OnItemFindGraphProp();
  170.     afx_msg void OnInsertExcel();
  171.     //}}AFX_MSG
  172.     DECLARE_MESSAGE_MAP()
  173. };
  174.  
  175.  
  176. /////////////////////////////////////////////////////////////////////////////
  177.  
  178. //{{AFX_INSERT_LOCATION}}
  179. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  180.  
  181. #endif // !defined(AFX_MAINVIEW_H__51F9B1ED_CAEF_11D4_A5D3_444553540000__INCLUDED_)
  182.